<ui:composition template="../principal.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:define name="principal">
        <h2>Configuração de Dados do Dentista</h2>
        
        <h:form id="breadcrumb">
            <p:breadCrumb styleClass="navegacao" style="margin-top: 5px; margin-bottom: 40px">  
                <c:if test="#{loginMB.dentista.contaUsuario.tipo == 'AD'}" >  
                    <p:menuitem value="Categories" url="../user-master/menuMaster.xhtml" />  
                </c:if>
                <c:if test="#{loginMB.dentista.contaUsuario.tipo == 'DE'}" >  
                    <p:menuitem value="Categories" url="../user-simple/menuDentista.xhtml" />  
                </c:if>
                <p:menuitem value="Configuração de Conta" url="../user-simple/configuracaoConta.xhtml" />
            </p:breadCrumb>
        </h:form>

        <h:form id="cad">
            <p:growl id="message"/>
            <p:fieldset legend="ATUALIZAR DADOS CADASTRAIS" toggleable="true" toggleSpeed="500" styleClass="grupo-form">
                <h:panelGrid columns="6" styleClass="table-form" cellspacing="10"> 
                    <h:outputLabel for="codigo" value="Código: " />  
                    <p:inputText id="codigo" title="codigo" value="#{configurarContaMB.dentista.id}" label="Codigo" disabled="true" size="5" />
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputLabel for="nome" value="*Nome: " />  
                    <p:inputText id="nome" title="nome" value="#{configurarContaMB.dentista.nome}" required="true" label="Nome" size="44" />
                    <h:outputLabel for="sobrenome" value="*Sobrenome: " />  
                    <p:inputText id="sobrenome" title="sobrenome" value="#{configurarContaMB.dentista.sobrenome}" required="true" label="Sobrenome" size="30"/>  
                    <h:outputLabel for="sexo" value="*Sexo: " />  
                    <p:selectOneMenu id="sexo" value="#{configurarContaMB.dentista.sexo}">
                        <f:selectItem itemLabel="Masculino" itemValue="M" />  
                        <f:selectItem itemLabel="Feminino" itemValue="F" /> 
                    </p:selectOneMenu>
                </h:panelGrid>

                <h:panelGrid columns="6" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="data" value="*Data de nascimento: " />  
                    <p:calendar locale="pt" id="data" title="data de nascimento" value="#{configurarContaMB.dentista.data_nascimento}" label="Data de nascimento" navigator="true" required="true" />
                    <h:outputLabel for="cpf" value="*CPF: " />  
                    <p:inputMask id="cpf" title="cpf" value="#{configurarContaMB.dentista.cpf}" required="true" mask="999.999.999-99"/>  
                    <h:outputLabel for="rg" value="*RG: " />  
                    <p:inputText id="rg" title="rg" value="#{configurarContaMB.dentista.rg}" required="true" label="RG" size="36"/>  
                </h:panelGrid>
                <h:panelGrid columns="1" style="text-align: right; width: 100%;">
                    <p:commandButton value="Salvar" update=":cad" action="#{configurarContaMB.atualizarDados()}" image="ui-icon ui-icon-disk" style="font-size: 15px;" />
                </h:panelGrid>
            </p:fieldset>

        </h:form>
        <h:form id="cad2">
            <p:fieldset legend="ATUALIZAR DADOS DO ENDEREÇO" toggleable="true" toggleSpeed="500" styleClass="grupo-form">
                <h:panelGrid columns="4" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="logradouro" value="*Logradouro: " />  
                    <p:inputText id="logradouro" title="logradouro" value="#{configurarContaMB.dentista.endereco.logradouro}" required="true" label="Logradouro" size="91"/> 
                    <h:outputLabel for="numero" value="*Numero: " />  
                    <p:inputText id="numero" title="numero" value="#{configurarContaMB.dentista.endereco.numero}" required="true" label="Numero" size="5"/>
                </h:panelGrid>

                <h:panelGrid columns="6" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="complemento" value="Complemento: " />  
                    <p:inputText id="complemento" title="complemento" value="#{configurarContaMB.dentista.endereco.complemento}" required="false" label="Complemento" size="30"/>
                    <h:outputLabel for="bairro" value="*Bairro: " />  
                    <p:inputText id="bairro" title="bairro" value="#{configurarContaMB.dentista.endereco.bairro}" required="true" label="Bairro" size="30"/>
                    <h:outputLabel for="cep" value="*CEP: " />  
                    <p:inputMask id="cep" title="cep" value="#{configurarContaMB.dentista.endereco.cep}" required="true" mask="99999-999"/>
                </h:panelGrid>

                <h:panelGrid columns="4" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="uf" value="*UF: " />  
                    <p:selectOneMenu id="uf" value="#{configurarContaMB.dentista.endereco.uf}" effect="fade" required="true" label="UF" style="width: 160px;" panelStyle="font-size: 12px;"> 
                        <f:selectItems value="#{configurarContaMB.estados}" var="uf" itemLabel="#{uf}" itemValue="#{uf}" />
                    </p:selectOneMenu>
                    <h:outputLabel for="cidade" value="*Cidade: " />  
                    <p:inputText id="cidade" title="cidade" value="#{configurarContaMB.dentista.endereco.cidade}" required="true" label="Cidade" size="30"/>
                </h:panelGrid>
                <h:panelGrid columns="1" style="text-align: right; width: 100%;">
                    <p:commandButton value="Salvar" update=":cad2, :cad:message" action="#{configurarContaMB.atualizarDados()}" image="ui-icon ui-icon-disk" style="font-size: 15px;" />
                </h:panelGrid>
            </p:fieldset>

        </h:form>
        <h:form id="cad3">
            <p:fieldset legend="ATUALIZAR DADOS DO CONTATO" toggleable="true" toggleSpeed="500" styleClass="grupo-form">
                <h:panelGrid columns="2" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="email" value="*Email: " />  
                    <p:inputText id="email" title="email" value="#{configurarContaMB.dentista.contato.email}" required="true" label="Email" size="50"/>
                </h:panelGrid>
                <h:panelGrid columns="4" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="telefone" value="*Telefone fixo: " />  
                    <p:inputMask id="telefone" title="telefone" value="#{configurarContaMB.dentista.contato.telefone}" required="true" mask="(99)9999-9999"/>
                    <h:outputLabel for="celular" value="Celular: " />  
                    <p:inputMask id="celular" title="celular" value="#{configurarContaMB.dentista.contato.celular}" required="false" mask="(99)9999-9999"/>
                </h:panelGrid>
                <h:panelGrid columns="1" style="text-align: right; width: 100%;">
                    <p:commandButton value="Salvar" update=":cad3, :cad:message" action="#{configurarContaMB.atualizarDados()}" image="ui-icon ui-icon-disk" style="font-size: 15px;" />
                </h:panelGrid>
            </p:fieldset>

        </h:form>
        <h:form id="cad4">
            <p:fieldset legend="ATUALIZAR DADOS PROFISSIONAIS" toggleable="true" toggleSpeed="500" styleClass="grupo-form">
                <h:panelGrid columns="2" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="cro" value="*CRO: " />  
                    <p:inputText id="cro" title="cro" value="#{configurarContaMB.dentista.cro}" required="true" label="CRO" size="30"/>
                </h:panelGrid>
                <h:panelGrid columns="3" styleClass="table-form" cellspacing="10">
                    <h:outputLabel for="cadastrar-especialidades" value="Escolher especialidades: " />
                    <p:selectCheckboxMenu id="cadastrar-especialidades" value="#{configurarContaMB.especialidadesSelecionadas}" label="Especialidades" filter="true" filterMatchMode="startsWith">  
                        <f:selectItems value="#{configurarContaMB.especialidadesTodas}" var="esp" itemLabel="#{esp.nome}" itemValue="#{esp.id}" />  
                    </p:selectCheckboxMenu>
                    <p:dataTable id="especialidades" var="especialidade" value="#{configurarContaMB.dentista.especialidades}" style="width: 200px;" emptyMessage="Sem especialidades">  
                        <p:column headerText="Especialidades Cadastradas">  
                            <h:outputText value="#{especialidade.nome}" />  
                        </p:column>
                    </p:dataTable>
                </h:panelGrid>
                <h:panelGrid columns="1" style="text-align: right; width: 100%;">
                    <p:commandButton value="Salvar" update=":cad4, :cad:message" action="#{configurarContaMB.atualizarDadosProfissionais()}" image="ui-icon ui-icon-disk" style="font-size: 15px;" />
                </h:panelGrid>
            </p:fieldset>

        </h:form>
        <h:form id="cad5">
            <p:fieldset legend="ATUALIZAR SENHA DA CONTA DE USUÁRIO" toggleable="true" toggleSpeed="500" styleClass="grupo-form" >
                <h:panelGrid columns="2" styleClass="table-form" cellspacing="10">

                    <h:outputLabel for="username" value="Username: " />  
                    <p:inputText id="username" title="username" value="#{configurarContaMB.dentista.contaUsuario.username}" label="Ssername" styleClass="campoTexto" disabled="true"/>
                    
                    <h:outputLabel for="senhaant" value="*Senha atual: " />
                    <p:password id="senhaant" title="senha" value="#{configurarContaMB.senhaat}"  styleClass="campoTexto" required="true" />

                    <h:outputLabel for="senha1" value="*Nova senha: " />
                    <p:password id="senha1" title="senha" value="#{configurarContaMB.senha1}" feedback="true"   
                                promptLabel="Preencha o campo com a senha desejada!" weakLabel="Senha fraca!"  
                                goodLabel="Boa senha!" strongLabel="Ótima senha!" styleClass="campoTexto" required="true" />

                    <h:outputLabel for="senha2" value="*Confirme a nova senha:"/>
                    <p:password id="senha2" title="confirme a senha" value="#{configurarContaMB.senha2}" feedback="true"   
                                promptLabel="Preencha o campo com a senha desejada!" weakLabel="Senha fraca!"  
                                goodLabel="Boa senha!" strongLabel="Ótima senha!" styleClass="campoTexto" required="true" /> 
                </h:panelGrid>
                <h:panelGrid columns="1" style="text-align: right; width: 100%;">
                    <p:commandButton value="Salvar" update=":cad5, :cad:message" action="#{configurarContaMB.atualizarDadosConta()}" image="ui-icon ui-icon-disk" style="font-size: 15px;" />
                </h:panelGrid>
            </p:fieldset>

        </h:form>

    </ui:define>
</ui:composition>